home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 December / Australian PC User - December 2003 (CD2).iso / software / apps / files / dwmx2k4.exe / Disk1 / data1.cab / Configuration_En / Objects / Script / SSI.js < prev   
Encoding:
JavaScript  |  2003-09-05  |  1.3 KB  |  39 lines

  1. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. //---------------     API FUNCTIONS    ---------------
  4.  
  5. function isDOMRequired()
  6.     // Return false, indicating that this object is available in code view.
  7.     return false;
  8. }
  9.  
  10. function objectTag()
  11. {
  12.   var bDialogState = dw.getShowDialogsOnInsert(); // Was dialog shown?
  13.   var newURL = browseForFileURL("select");
  14.  
  15.   if ((newURL == '') && bDialogState)
  16.     return '';
  17.  
  18.   // Attempt to get SSI used for connection include file if Server Model is defined for page
  19.   // and the URL doesn't already contain directive syntax.  Nested directives are bad.
  20.   var insertText = "";
  21.   if (newURL.indexOf("<%") == -1 &&
  22.       newURL.indexOf("<?") == -1 &&
  23.       dw.getDocumentDOM().serverModel.getDisplayName() != "")
  24.     insertText = dw.getExtDataValue("connectioninc_statement", "insertText");
  25.  
  26.   // Default to NCSA SSI
  27.   if (insertText == "" || insertText.indexOf('@@connectionURL@@') == -1)
  28.       insertText = '<!--#include file="@@connectionURL@@" -->';
  29.  
  30.   // For Apache include, use 'virtual' for site relative file paths, otherwise 'file'
  31.   insertText = (newURL.substring(0,1) == "/")
  32.                 ? insertText.replace("#include file", "#include virtual")
  33.                 : insertText.replace("#include virtual", "#include file");
  34.  
  35.   return (insertText.replace('@@connectionURL@@', newURL));
  36. }
  37.  
  38.